import Axios from '@/http'
import {loginData,registerData} from './index_type'
const http = new Axios({
    timeout:5000,
    baseURL:'/front'
});
//验证码
export const getCodeApi = ()=>{
    return http.get('/code')
}
//登录
export const loginApi = (data:loginData)=>{
    return http.post('/login',data)
}
//注册
export const registerApi = (data:registerData)=>{
    return http.post('/register',data)
}
//用户信息
export const userInfoApi = (id:number)=>{
    return http.get(`/user/${id}`)
}
//首页频道信息
export const homeChannelInfoListApi = ()=>{
    return http.get(`/index_channel`)
}
//获取频道分类
export const ChannelCategoryInfoApi = (id:number)=>{
    return http.get(`/channel_cate/${id}`);
}
//获取书信息
export const bookInfoListApi = (id:number|Array<number>)=>{
    return http.post(`/books`,{id})
}
//上传头像
export const uploadUserAvatarApi = (data:FormData)=>{
    return http.post('/user_upload',data,{'Content-Type': 'multipart/form-data'})
}